//
//  LRJ_TextureMakerAndResponder+CoordinateTF.m
//  LRJAansyDraw
//
//  Created by imac_LRJ on 2022/6/9.
//

#import "LRJ_TextureMakerAndResponder+CoordinateTF.h"

@implementation LRJ_TextureMakerAndResponder (CoordinateTF)
- (CGPoint)convertPointFromLayout:(CGPoint)point offsetPoint:(CGPoint)offsetPoint
{
    point.x += offsetPoint.x;
    point.y += offsetPoint.y;
    return point;
}

- (CGPoint)convertPointToLayout:(CGPoint)point offsetPoint:(CGPoint)offsetPoint
{
    point.x -= offsetPoint.x;
    point.y -= offsetPoint.y;
    return point;
}

- (CGRect)convertRectFromLayout:(CGRect)rect offsetPoint:(CGPoint)offsetPoint
{
    if (CGRectIsNull(rect)) {
        return rect;
    }
    
    rect.origin = [self convertPointFromLayout:rect.origin offsetPoint:offsetPoint];
    return rect;
}

- (CGRect)convertRectToLayout:(CGRect)rect offsetPoint:(CGPoint)offsetPoint
{
    if (CGRectIsNull(rect)) {
        return rect;
    }
    
    rect.origin = [self convertPointToLayout:rect.origin offsetPoint:offsetPoint];
    return rect;
}
@end
